from typing import List
from model.Book import Book
from dao.BookDao import BookDao


class BookService:
    def list(self) -> List[Book]:
        # books = [
        #     {
        #         "title": "Python 编程从入门到实践",
        #         "author": "Eric Matthes",
        #         "price": 19.9,
        #     },
        #     {"title": "Flask Web 开发实战", "author": "李辉", "price": 49.5},
        # ]
        bookDao = BookDao()
        books = bookDao.list()
        return books
    def add(self,book:Book)->None:
        bookDao = BookDao()
        bookDao.add(book)